var rootview = ui("$");
var app = sm("do_App");
var page = sm("do_Page");
var nf = sm("do_Notification");
var global = sm("do_Global");
var common = require("common");
var openHelper = require("helper/open");
var http = require("helper/http");
var pubUrl = require("url/pub");
var bizzType = require("helper/bizzType");

//图片展示gridView
var do_GridView_1 = ui("do_GridView_1");
var labelBizzType=ui("labelBizzType");
var bizzTypeName = ['话题','投票','活动'];
var bizzTypeColor = ['F7B52CFF','BFA5E4FF','DCAD92FF','FFA352FF','77CEE5FF','E590B8FF'];

rootview.setMapping({   // 此处的Mapping只能设置在 RootView 上 ;
	"labelBizzType.tag":"bizzType",
    "UserName.text" : "creatorName",
    "UserPic.tag" : "creatorId",
    "UserPic.source" : "fullCreatorImg",
    "InforDescribe.text" : "content",
    "InforTime.text" : "cnNewAt",
    "InforReply.text" : "commentCount",
    "InforZan.text" : "praiseCount",
    "do_ImageView_5.tag" : "isPraised",
    "do_GridView_1.tag" : "bigImgItems",//新版图片集合
    "do_GridView_1.items" : "imgItems",//新版图片集合
    "do_GridView_1.visible" : "hasImg",
    "do_ALayout_4.tag" : "id",
    "lableGrade.text" : "creatorGradeName"
});

rootview.on("dataRefreshed", function(){
	labelBizzType.text=bizzTypeName[labelBizzType.tag-1];
	labelBizzType.fontColor=bizzTypeColor[labelBizzType.tag-1];
	if(ui("lableGrade").text ==""){
		ui("lineLayoutGrade").visible = false;
	}else{
		ui("lineLayoutGrade").visible = true;
	}
	
	if(ui("do_ImageView_5").tag == 1){
		ui("do_ImageView_5").source = "source://image/common/praise1.png";
	}else{
		ui("do_ImageView_5").source = "source://image/common/praise.png";
	}
});

//图片浏览注册事件
do_GridView_1.on("touch", function(data){
	openHelper.open("source://view/reuse/imgBrowser.ui", {
		imgDatas :do_GridView_1.tag,index:data
	});
});

//点击个人头像-他的人个主页
ui("alayoutUserInfo").on("touch", function(data, e) {
	var userId = ui("UserPic").tag;
	if(userId !=null){
		openHelper.openPersonal(userId);
	}
	
});